package com.dreamthen.entity;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author zengms
 * @Date 2023-10-13 14:26:23
 **/
public class Person implements InitializingBean, DisposableBean {

    private String id;
    private String name;
    private String realName;
    private String sex;
    private Date birthday;
    private List<String> hobbies;
    private List<Dept> dept;
    private Map<String, String> course;
    private Company company;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public List<String> getHobbies() {
        return hobbies;
    }

    public void setHobbies(List<String> hobbies) {
        this.hobbies = hobbies;
    }

    public List<Dept> getDept() {
        return dept;
    }

    public void setDept(List<Dept> dept) {
        this.dept = dept;
    }

    public Map<String, String> getCourse() {
        return course;
    }

    public void setCourse(Map<String, String> course) {
        this.course = course;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public Person(Company company) {
        this.company = company;
    }

    @Override
    public String toString() {
        return "Person{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", realName='" + realName + '\'' +
                ", sex='" + sex + '\'' +
                ", birthday=" + (null != birthday ? new SimpleDateFormat("yyyy-MM-dd").format(birthday) : birthday) +
                ", hobbies=" + hobbies +
                ", dept=" + dept +
                ", course=" + course +
                ", company=" + company +
                '}';
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("初始化person");
    }

    public void destroy() throws Exception {
        System.out.println("销毁person");
    }

    public void initByConfig(){
        System.out.println("****init person***");
    }
    public void destroyByConfig(){
        System.out.println("****destory person****");
    }
}
